﻿<%@ Page Language="C#" MasterPageFile="~/Search/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Search_HR_Default" Title="无标题页" %>

<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
 
<script type="text/javascript">
        var template = '<span style="color:{0};">{1}</span>';

        var Shenhe = function (value) {
            if(value==0){return String.format(template,'red', '未审');}
            if(value==1){return String.format(template,'green', '同意');}
            if(value==2){return String.format(template,'blue', '退回');}
        }
    </script>
<ext:Store runat="server" ID="Store_dept">
<Reader>
    <ext:JsonReader ReaderID="id">
        <Fields>
            <ext:RecordField Name="id" Type="Int"></ext:RecordField>
            <ext:RecordField Name="deptname" Type="String"></ext:RecordField>
        </Fields>
    </ext:JsonReader>
</Reader>
</ext:Store>

 <ext:Store runat="server" ID="StoreUserbase">
            <Reader>
                <ext:JsonReader ReaderID="uid">
                    <Fields>
                        <ext:RecordField Name="uid" Type="Int"></ext:RecordField>
                        <ext:RecordField Name="deptname" Type="String"></ext:RecordField>
                        <ext:RecordField Name="username" Type="String"></ext:RecordField>
                    </Fields>
                </ext:JsonReader>
            </Reader>
        </ext:Store>
 <ext:Store runat="server" ID="StoreDetail" OnRefreshData="StoreDetail_onRefresh">
            <Reader>
                <ext:JsonReader ReaderID="guid">
                    <Fields>
                        <ext:RecordField Name="id" Type="Int"></ext:RecordField>
                        <ext:RecordField Name="adept_master_status" Type="Int"></ext:RecordField>
                        <ext:RecordField Name="dept_master_status" Type="Int"></ext:RecordField>
                        <ext:RecordField Name="boss_status" Type="Int"></ext:RecordField>
                        <ext:RecordField Name="intime" Type="Date"></ext:RecordField>
                        <ext:RecordField Name="guid" Type="String"></ext:RecordField>
                    </Fields>
                </ext:JsonReader>
            </Reader>
            <BaseParams>
                <ext:Parameter 
                Name="uid" 
                Value="#{GridPanel1}.getSelectionModel().hasSelection() ? #{GridPanel1}.getSelectionModel().getSelected().id : -1"
                Mode="Raw">                    
                </ext:Parameter>
            </BaseParams>
         </ext:Store>       
        
<ext:ViewPort runat="server">
    <Body>
    <ext:RowLayout ID="RowLayout1" runat="server" Split="true">
                <ext:LayoutRow RowHeight="0.1">
         <ext:FormPanel ID="FormPanel1"  runat="server" BodyStyle="padding:5px;" 
                        Frame="true">
                        <Body>
                            <ext:ContainerLayout ID="ContainerLayout1" runat="server">
                                <ext:Panel  ID="Panel1" runat="server" >
                                    <Body>
                                    <table style="width:100%; text-align:left;">
                                        <tr>
                                            <td style="text-align:left">员工姓名:<ext:TextField runat="server" ID="tfusername"></ext:TextField>
                                            </td>
                                            <td style="text-align:left">
                                            所属部门:
                                            </td>
                                            <td style="text-align:left">
                                            <ext:ComboBox runat="server" StoreID="Store_dept" ID="tfdeptid" DisplayField="deptname" ValueField="id" Editable="false"></ext:ComboBox></td>
                                            
                                            <td style="text-align:left">
                                            <ext:Button runat="server" ID="subsearch" Text="查询" Icon="ApplicationGet">
                                                 <AjaxEvents>
                                                    <Click OnEvent="Search"></Click>
                                                 </AjaxEvents>
                                            </ext:Button></td>
                                        </tr>
                                    </table>
                                    </Body>
                                </ext:Panel>
                            </ext:ContainerLayout>
                        </Body> 
                    </ext:FormPanel>
                    </ext:LayoutRow>
 <ext:LayoutRow RowHeight="0.4">
        
         <ext:GridPanel ID="GridPanel1"  Frame="true" StoreID="StoreUserBase" Height="150" Title="员工搜索结果"   runat="server">
                        <ColumnModel>
                            <Columns>
                                <ext:Column ColumnID="uid" DataIndex="uid" Header="员工编号"></ext:Column>
                                <ext:Column ColumnID="username" DataIndex="username" Header="用户名"></ext:Column>
                                <ext:Column ColumnID="deptname" DataIndex="deptname" Header="部门"></ext:Column>
                            </Columns>
                        </ColumnModel>
                        <SelectionModel>
                            <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true">
                                <Listeners>
                                    <RowSelect Handler="#{StoreDetail}.reload()" Buffer="250"  />
                                                                        
                                </Listeners>
                            </ext:RowSelectionModel>
                        </SelectionModel>
                    <LoadMask ShowMask="true" />
                    </ext:GridPanel>
                    </ext:LayoutRow>
 <ext:LayoutRow RowHeight="0.5">
         
         <ext:GridPanel ID="GridPanel2" Frame="true" StoreID="StoreDetail" Height="200" Title="诚信档案" runat="server">
            <ColumnModel>
                <Columns>
                    <ext:Column ColumnID="id" DataIndex="id" Header="编号"></ext:Column>
                    <ext:Column ColumnID="guid" DataIndex="guid" Hidden="true"></ext:Column>
                    <ext:Column ColumnID="adept_master_status" DataIndex="adept_master_status" Header="人事领导">
                        <Renderer Fn="Shenhe" />
                    </ext:Column>
                    <ext:Column ColumnID="dept_master_status" DataIndex="dept_master_status" Header="部门领导">
                        <Renderer Fn="Shenhe" />
                    </ext:Column>
                    <ext:Column ColumnID="boss_status" DataIndex="boss_status" Header="公司领导">
                        <Renderer Fn="Shenhe" />
                    </ext:Column>
                    <ext:Column ColumnID="intime" DataIndex="intime" Header="时间">
                        <Renderer Fn="Ext.util.Format.dateRenderer('Y-m-d')" />
                    </ext:Column>
                    <ext:CommandColumn ColumnID="Apply" Header="申请">
                        <Commands>
                            <ext:GridCommand CommandName="Apply" Icon="ApplicationGet" >
                                <ToolTip  Text="申请查询"/>
                            </ext:GridCommand>
                        </Commands>
                    </ext:CommandColumn>
                </Columns>
            </ColumnModel>
 
             <AjaxEvents>
                <Command OnEvent="ApplySub">
                
                    <ExtraParams>
                        <ext:Parameter Name="id" Value="record.data.guid" Mode="Raw">
                        </ext:Parameter> 
                    </ExtraParams>
                </Command>
             </AjaxEvents>
            <LoadMask ShowMask="true" />
         </ext:GridPanel>
         </ext:LayoutRow>
    </ext:RowLayout>
    </Body>
</ext:ViewPort>
    <ext:Window ID="Window1"  Modal="true"  Width="200" Height="150" Closable="false" runat="server" Resizable="false" ShowOnLoad="false" Collapsible="false" Icon="BuildingGo" Title="查询申请:原因">
        <Body>
            <ext:FormPanel runat="server" ID="ApplyForm">
                <Body>
                <ext:ContainerLayout runat="server" ID="containter">
                    <ext:Panel ID="Panel2" runat="server" >
                        <Body>
                        <table style="width:100%">
                            <tr>
                                <td>
                                <ext:Hidden ID="tfhiddenid" runat="server" ></ext:Hidden>
                                <ext:TextArea runat="server" Width="180" ID="tfreason"></ext:TextArea>
                                </td>
                            </tr>
                        </table> 
                        </Body>
                    </ext:Panel>
                </ext:ContainerLayout>
                </Body>
                <Buttons>
                    <ext:Button runat="server" ID="SubApply" Text="提交">
                        <AjaxEvents>
                            <Click OnEvent="Sub">                        
                            </Click>
                        </AjaxEvents>
                    </ext:Button>
                    <ext:Button runat="server" ID="Button1" Text="撤销">
                        <AjaxEvents>
                            <Click OnEvent="Cancel">                        
                            </Click>
                        </AjaxEvents>
                    </ext:Button>
                </Buttons>
            </ext:FormPanel>
        </Body>
    </ext:Window>
</asp:Content>

